
import java.util.ArrayList;
import java.util.Random;

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 *
 * @author Thomas
 */
public class combatObject extends gameObject{
    ArrayList<ability> skills;
    combatData Params;
    public combatObject(String N, String D, combatData Stats){
        super(N, D);
        Params = Stats;
    }
    public combatObject(String N, int hp, int spd, int atk){
        super(N, null);
        Params = new combatData(hp, hp, 0, 0, atk, 0, 0, 0, spd);
        ability temp = new attack(true);
        skills = new ArrayList<ability>(1);
        skills.add(temp);
    }
    int getHP(){
        return Params.hp;
    }
    int getMaxHP(){
        return Params.mhp;
    }
    int getMP(){
        return Params.mp;
    }
    int getMaxMP(){
        return Params.mmp;
    }
    int getAttack(){
        return Params.atk;
    }
    int getMagicAttack(){
        return Params.matk;
    }
    int getDefense(){
        return Params.def;
    }
    int getResistance(){
        return Params.res;
    }
    int getSpeed(){
        return Params.spd;
    }
    boolean isAlive(){
        if(getHP() > 0)
            return true;
        else
            return false;
    }
    public void affectHP(int val){
        Params.hp -= val;
        if(Params.hp < 0)
            Params.hp = 0;
        else if(Params.hp > Params.mhp)
            Params.hp = Params.mhp;
        else{
            return;
        }
    }
    String HPString(){
        return "HP: " + getHP() +"/"+ getMaxHP();
    }
    public void printNHpMp(){
        System.out.println(Name);
        Params.printHP();
        Params.printMP();
    }
    public void act(ArrayList<combatObject> Friends, ArrayList<combatObject> Enemies){
        if (!isAlive())
            return;
        skills.get(0).effect(this, Friends, Enemies);
    }
}
